using Game.Scripts.Constant;
using Game.Scripts.Interface;
using Game.Scripts.Service;
using MoreMountains.Feedbacks;
using UnityEngine;
using Zenject;

namespace Game.Scripts.Entity.Placeable
{
    public class Obstacle : MonoBehaviour, IPlaceable
    {
        [SerializeField] private MMF_Player playerEnterFeedback;
        private IkunBus _ikunBus;
        private GameService _gameService;
       

        [Inject]
        public void Construct(IkunBus ikunBus, GameService gameService)
        {
            _ikunBus = ikunBus;
            _gameService = gameService;
        }

        public void OnPlayerEnter()
        {
            playerEnterFeedback.PlayFeedbacks();
            _gameService.playerHealth.Value -= 1;
        }


        private void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.CompareTag(TagType.Player))
            {
                OnPlayerEnter();
            }
        }
    }
}